#ifndef SPKBUTTON_H
#define SPKBUTTON_H

#include <QPropertyAnimation>
#include <QPushButton>


class SpkButton : public QPushButton
{
    Q_OBJECT
public:
    SpkButton(QString pixnormal, QString pixenter, QString pixleave, QWidget *parent = nullptr);
    ~SpkButton();

private:
    QPropertyAnimation *m_enteranimation;
    QPropertyAnimation *m_leaveanimation;

    QList<QPixmap> m_enterlist;
    QList<QPixmap> m_leavelist;
    QPixmap m_pixnormal;
    int m_leaveIndex;
    int m_enterIndex;
    bool m_enter;
    bool m_leave;

    // QWidget interface
protected:
    void enterEvent(QEvent *event) override;
    void leaveEvent(QEvent *event) override;
    void paintEvent(QPaintEvent *event) override;

public slots:
    void entervaluechange(QVariant var);
    void leavevaluechange(QVariant var);
};

#endif // SPKBUTTON_H
